require("../../assets/css/index.less")
require("./map.less")
const {  isLogin, ready, addEvent, } = require("../../utils/dom")

isLogin()

ready(()=>{
    function loadJScript() {
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = '//api.map.baidu.com/api?type=webgl&v=1.0&ak=FsR8kW3zgftmCbdAWIII0SkQKeCZX1e7&callback=init';
        document.body.appendChild(script);
    }
    function init() {
        var map = new BMapGL.Map('map'); // 创建Map实例
        var point = new BMapGL.Point(116.404, 39.915); // 创建点坐标
        map.centerAndZoom(point, 10);
        map.enableScrollWheelZoom(); // 启用滚轮放大缩小
        function myFun(result) {
            var cityName = result.name;
            map.setCenter(cityName);
        }
        var myCity = new BMapGL.LocalCity();
        myCity.get(myFun);
    }
    loadJScript();
    window.onload = init; // 异步加载地图

    addEvent("#goBack",()=>history.go(-2))
})